import { createRouter, createWebHistory } from 'vue-router'
import index from '../views/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'index',
      component: index  // 保持同步加载
    },
    {
      path: '/loginByPassword',
      name: 'LoginByPassword',
      component: () => import('../views/Login.vue'),  // 已经是懒加载
      meta: {
        preload: true
      }
    },
    {
      path: '/basicInfo',
      name: 'basicInfo',
      component: () => import('../views/basicInfo.vue')  // 改为懒加载
    },
    {
      path: '/memberInfo',
      name: 'memberInfo',
      component: () => import('../views/memberInfo.vue')  // 改为懒加载
    },
    {
      path: '/formPage',
      name: 'formPage',
      component: () => import('../views/formPage.vue')  // 改为懒加载
    },
    {
      path: '/companyInfo',
      name: 'companyInfo',
      component: () => import('../views/companyInfo.vue')  // 改为懒加载
    },
    {
      path: '/detailPage',
      name: 'detailPage',
      component: () => import('../views/detailPage.vue')  // 改为懒加载
    },
    {
      path: '/detailBasic',
      name: 'detailBasic',
      component: () => import('../views/detial/detailBasic.vue')  // 改为懒加载
    },
    {
      path: '/detailUpload',
      name: 'detailUpload',
      component: () => import('../views/detial/detailUpload.vue')  // 改为懒加载
    },
    {
      path: '/detailChart',
      name: 'detailChart',
      component: () => import('../views/detial/detailChart.vue')  // 改为懒加载
    },
    {
      path: '/managerPage',
      name: 'managerPage',
      component: () => import('../views/managerPage.vue')  // 改为懒加载
    },
    {
      path: '/LoginByPhone',
      name: 'LoginByPhone',
      component: () => import('../views/LoginByPhone.vue'),  // 已经是懒加载
      meta: {
        preload: true
      }
    },
    {
      path: '/reportPage',
      name: 'reportPage',
      component: () => import('../views/reportPage.vue')  // 改为懒加载
    },
    {
      path: '/qrcodePage',
      name: 'qrcodePage',
      component: () => import('../views/qrcodePage.vue')  // 改为懒加载
    },
    {
      path: '/org-chart',
      name: 'OrganizationChart',
      component: () => import('../views/OrganizationChartPage.vue')  // 改为懒加载
    }
  ]
})
export default router